Method and apparatus for performing logical compare operation

ABSTRACT

A method and apparatus for including in a processor instructions for performing logical-comparison and branch support operations on packed or unpacked data. In one embodiment, instruction decode logic decodes instructions for an execution unit to operate on packed data elements including logical comparisons. A register file including 128-bit packed data registers stores packed single-precision floating point (SPFP) and packed integer data elements. The logical comparisons may include comparison of SPFP data elements and comparison of integer data elements and setting at least one bit to indicate the results. Based on these comparisons, branch support actions are taken. Such branch support actions may include setting the at least one bit, which in turn may be utilized by a branching unit in response to a branch instruction. Alternatively, the branch support actions may include branching to an indicated target code location.

RELATED APPLICATIONS

This is a Continuation of U.S. patent application Ser. No. 13/082,726,now pending, which is a Continuation of U.S. patent application Ser. No.11/525,706, filed Sep. 21, 2006, now U.S. Pat. No. 7,958,181.

FIELD OF THE INVENTION

This disclosure relates generally to the field of processors. Inparticular, the disclosure relates to using a single control signal toperform multiple logical compare operations on multiple bits of data.

BACKGROUND OF THE INVENTION

In typical computer systems, processors are implemented to operate onvalues represented by a large number of bits (e.g., 64) usinginstructions that produce one result. For example, the execution of anadd instruction will add together a first 64-bit value and a second64-bit value and store the result as a third 64-bit value. Multimediaapplications (e.g., applications targeted at computer supportedcooperation (CSC—the integration of teleconferencing with mixed mediadata manipulation), 2D/3D graphics, image processing, videocompression/decompression, recognition algorithms and audiomanipulation) require the manipulation of large amounts of data. Thedata may be represented by a single large value (e.g., 64 bits or 128bits), or may instead be represented in a small number of bits (e.g., 8or 16 or 32 bits). For example, graphical data may be represented by 8or 16 bits, sound data may be represented by 8 or 16 bits, integer datamay be represented by 8, 16 or 32 bits, and floating point data may berepresented by 32 or 64 bits.

To improve efficiency of multimedia applications (as well as otherapplications that have the same characteristics), processors may providepacked data formats. A packed data format is one in which the bitstypically used to represent a single value are broken into a number offixed sized data elements, each of which represents a separate value.For example, a 128-bit register may be broken into four 32-bit elements,each of which represents a separate 32-bit value. In this manner, theseprocessors can more efficiently process multimedia applications.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example and notlimitation in the figures of the accompanying drawings.

FIGS. 1 a-1 c illustrate example computer systems according toalternative embodiments of the invention.

FIGS. 2 a-2 b illustrate register files of processors according toalternative embodiments of the invention.

FIG. 3 illustrates a flow diagram for at least one embodiment of aprocess performed by a processor to manipulate data.

FIG. 4 illustrates packed data types according to alternativeembodiments of the invention.

FIG. 5 illustrates in-register packed byte and in-register packed worddata representations according to at least one embodiment of theinvention.

FIG. 6 illustrates in-register packed doubleword and in-register packedquadword data representations according to at least one embodiment ofthe invention.

FIGS. 7 a-7 d are flow diagrams illustrating various embodiments ofprocesses for performing logical-compare, set-zero-and-carry-flagoperations.

FIGS. 8 a-8 c illustrate alternative embodiments of circuits forperforming logical-compare, set-zero-and-carry-flag operations.

FIG. 9 is a block diagram illustrating various embodiments of operationcode formats for processor instructions.

DETAILED DESCRIPTION

Disclosed herein are embodiments of methods, systems and circuits forincluding in a processor instructions for performing logical compareoperations on multiple bits of data in response to a single controlsignal. The data involved in the logical compare operations may bepacked or unpacked data. For at least one embodiment, a processor iscoupled to a memory. The memory has stored therein a first datum and asecond datum. The processor performs logical compare operations on dataelements in the first datum and the second datum in response toreceiving an instruction. The logical compare operations may include abitwise AND of data elements in the first and second datum and may alsoinclude a bitwise AND of the complement of data elements of the firstdatum with data elements of the second datum. At least two status flagsof the processor are modified based on the results of the logicalcompare operations. These two status flags may include the zero flag andthe carry flag. These flags may be architecturally visible toapplication programs, and may be part of a larger flag value, such as anarchitecturally visible extended flags (EFLAGS) register.

These and other embodiments of the present invention may be realized inaccordance with the following teachings and it should be evident thatvarious modifications and changes may be made in the following teachingswithout departing from the broader spirit and scope of the invention.The specification and drawings are, accordingly, to be regarded in anillustrative rather than restrictive sense and the invention measuredonly in terms of the claims.

Definitions

To provide a foundation for understanding the description of theembodiments of the invention, the following definitions are provided.

Bit X through Bit Y:

-   -   defines a subfield of binary number. For example, bit six        through bit zero of the byte 00111010₂ (shown in base two)        represent the subfield 111010₂. The ‘₂’ following a binary        number indicates base 2. Therefore, 1000₂ equals 8₁₀, while F16        equals 15₁₀.    -   R_(x): is a register. A register is any device capable of        storing and providing data. Further functionality of a register        is described below. A register is not necessarily, included on        the same die or in the same package as the processor.

SRC and DEST:

-   -   identify storage areas (e.g., memory addresses, registers, etc.)

Source1-i and Result1-i and Destin: represent data.

Overview

This application describes embodiments of methods, apparatuses andsystems for including in a processor instructions for logical compareoperations on packed or unpacked data. More specifically, theinstructions may be for logically comparing data and then setting thezero and carry flags based on the comparisons. For at least oneembodiment, two logical compare operations are performed using a singleinstruction as shown below in Table 1a and Table 1b. The compareoperations include a bit-wise logical AND of the destination and sourceoperands, as well as a bit-wise logical AND of the complement of thedestination operand with the source operand. Table 1a shows a simplifiedrepresentation of one embodiment of the disclosed logical compareoperations, while Table 1b shows a bit-level example of an embodiment ofthe disclosed logical compare instructions, given some sample values.For the embodiments illustrated in Tables 1a and 1b, the data in thesource and destination operand may be of any data representation and isnot necessarily packed data, though it could be packed data. Where thedata of the source and/or destination operands is a single entity of128-bits, and therefore is not considered “packed” data, it will bereferred to herein as “unpacked” data, which simply means that the datais not necessarily subdivided into component representations and may beconsidered a single data value. While the data in Table 1a isrepresented, for simplicity of illustration, as a 32-bit value, one ofskill in the art will recognize that the concept being illustrated inTables 1a and 1b may be applied to data of any length, including smallerdata lengths (e.g., 4-bit, 8-bit, and 16-bit lengths) as well as largerdata lengths (e.g., 64-bit and 128-bit lengths).

TABLE 1A Logical Compare Dest, Source Destination Operand Dest SourceOperand Source Dest AND (bitwise) Source Int. Result1 [NOT Dest] AND(bitwise) Source Int. Result2 Set if Int. Result1 = all 0's; otherwisereset Zero Flag Set if Int. Result2 = all 0's; otherwise reset CarryFlag

TABLE 1B Logical Compare Dest, Source-Example Values Destination Operand10101010010101010000111100000000 Source Operand01010101101010101111000000001111 Dest AND (bitwise) Source00000000000000000000000000000000 [NOT Dest] AND Source01010101101010101111000000001111 ZERO FLAG = TRUE CARRY FLAG = FALSE

For at least one embodiment, the data values for the source anddestination operands may represent packed data. Each of the packedcomponents of the source and destination operands for such embodimentmay represent any type of data.

Tables 2a and 2b illustrate that components A₁ through A₄ and B₁ throughB₄ each represent binary representations of 32-bit single-precisionfloating point numbers. However, such illustration should not be takento be limiting. One of skill in the art will recognize that each of thecomponents may represent any data, including any integral or floatingpoint data format, as well as string format or any other type of dataformat.

TABLE 2A Logical Compare Dest, Source A₁ A₂ A₃ A₄ Dest B₁ B₂ B₃ B₄Source Dest AND (bitwise) Source Int. Result1 [NOT Dest] AND (bitwise)Source Int. Result2 Set if Int. Result1 = all 0's; otherwise reset ZeroFlag Set if Int. Result2 = all 0's; otherwise reset Carry Flag

TABLE 2B Logical Compare Dest, Source-Example Values A1: −118.625 A2:0.15625 A3: −2.125 A4: 2.5 1100001011101101 00111110001000001100000000001000 0100000000100000 0100000000000000 00000000000000000000000000000000 0000000000000000 B1: −0.0 B2: 0.0 B3: −0.0 B4: 0.01000000000000000 0000000000000000 1000000000000000 00000000000000000000000000000000 0000000000000000 0000000000000000 0000000000000000 A1AND B1 A2 AND B2 A3 AND B3 A4 AND B4 1000000000000000 00000000000000001000000000000000 0000000000000000 0000000000000000 00000000000000000000000000000000 0000000000000000 [NOT A1]AND B1 [NOT A2] AND B2 [NOTA3] AND B3 [NOT] A4 AND B4 0000000000000000 00000000000000000000000000000000 0000000000000000 0000000000000000 00000000000000000000000000000000 0000000000000000 ZERO FLAG = FALSE CARRY FLAG = TRUE

For packed embodiments, such as that illustrated by Tables 2a and 2b,alternative embodiments may be employed such that only certain bits ofeach packed element are operated upon during the compare operation. Forexample, at least some such alternative embodiments are discussed belowin connection with the discussion of FIGS. 7 c, 7 d, 8 b, and 8 c.

One of skill in the art will recognize that intermediate values “Int.Result1” and “Int. Result2” are shown in Tables 1a and 2a and that thethird and fourth rows of binary values are show in Tables 1b and 2b forease of illustration only. Their representation in Tables 1a through 2bshould not be taken to imply that such intermediate values arenecessarily stored within the processor, although they may be so storedfor at least one embodiment. Alternatively, for at least one otherembodiment, such intermediate values are determined via circuitrywithout storing said values in a storage area.

Tables 1a, 1b, 2a and 2b, above, describe embodiments of a “logicalcompare, set zero and carry flags” (“LCSZC”) instruction that performs abitwise AND operation on each of the 128 bits of the source anddestination operands, and also performs a bitwise AND operation of eachof the 128 bits of the source operand with each of the 128 bits of thecomplemented value of the destination operand, and sets the zero andcarry flags according to the results of the AND operations.

The setting of the zero and carry flags supports branching behaviorbased on the logical comparisons. For at least one embodiment, the LCSZCinstruction may be followed by a separate branch instruction thatindicates the desired branching operation to be performed by theprocessor, base on the value of one or both of the flags (see, e.g.,pseudocode in Table 4, below). One of skill in art will recognize thatsetting of status flags are not the only hardware mechanism by whichbranching operations may utilize the comparison results, and othermechanisms may be implemented in order to support branching based on theresults of the comparisons. Thus, although specific embodimentsdescribed below indicate that zero and carry flags may be set as aresult of the logical comparison, such flag-setting in support ofbranching is not required for all embodiments. Accordingly, the term“LCSZC” as used herein should not be taken to be limiting, in that thesetting of the zero and carry flags is not necessary for allembodiments.

For one alternative embodiment, for example, the branching behavior maybe performed as a direct result of a variant of the LCSZC instructionthat fuses the comparison and branching in one instruction, such asfused “test-and-branch” instruction. For at least one embodiment of thefused “test-and-branch” instruction, no status flag is set as a resultof the logical comparisons performed.

Alternative embodiments may vary the number of bits in the data elementsand the intermediate results. Also, alternative embodiments may compareonly some bits of the respective source and destination values. Inaddition, alternative embodiment may vary the number of data elementsused and the number of intermediate results generated. For example,alternative embodiments may include but are not limited to: a LCSZCinstruction for an unsigned source and a signed destination; a LCSZCinstruction for a signed source and an unsigned destination; a LCSZCinstruction for an unsigned source and an unsigned destination; and aLCSZC instruction for a signed source and a signed destination. In eachof the examples, said source and destination may each contain packeddata of 8-bit, 16-bit, 32-bit, or 64-bit components. Alternatively, saidsource and destination data is not packed, but is instead a 128-bit dataelement. The packed nature of the source and destination need not besymmetric, and the size of data for the source and destination, if bothare packed, need not necessarily be the same.

Computer System

FIG. 1 a illustrates an example computer system 100 according to oneembodiment of the invention. Computer system 100 includes aninterconnect 101 for communicating information. The interconnect 101 mayinclude a multi-drop bus, one or more point-to-point interconnects, orany combination of the two, as well as any other communications hardwareand/or software.

FIG. 1 a illustrates a processor 109, for processing information,coupled with interconnect 101. Processor 109 represents a centralprocessing unit of any type of architecture, including a CISC or RISCtype architecture.

Computer system 100 further includes a random access memory (RAM) orother dynamic storage device (referred to as main memory 104), coupledto interconnect 101 for storing information and instructions to beexecuted by processor 109. Main memory 104 also may be used for storingtemporary variables or other intermediate information during executionof instructions by processor 109.

Computer system 100 also includes a read only memory (ROM) 106, and/orother static storage device, coupled to interconnect 101 for storingstatic information and instructions for processor 109. Data storagedevice 107 is coupled to interconnect 101 for storing information andinstructions.

FIG. 1 a also illustrates that processor 109 includes an execution unit130, a register file 150, a cache 160, a decoder 165, and an internalinterconnect 170. Of course, processor 109 contains additional circuitrythat is not necessary to understanding the invention.

Decoder 165 is for decoding instructions received by processor 109 andexecution unit 130 is for executing instructions received by processor109. In addition to recognizing instructions typically implemented ingeneral purpose processors, decoder 165 and execution unit 130 recognizeinstructions, as described herein, for performinglogical-compare-and-set-zero-and-carry-flags (LCSZC) operations. Thedecoder 165 and execution unit 130 recognize instructions for performingLCSZC operations on both packed and unpacked data.

Execution unit 130 is coupled to register file 150 by internalinterconnect 170. Again, the internal interconnect 170 need notnecessarily be a multi-drop bus and may, in alternative embodiments, bea point-to-point interconnect or other type of communication pathway.

Register file(s) 150 represents a storage area of processor 109 forstoring information, including data. It is understood that one aspect ofthe invention is the described instruction embodiments for performingLCSZC operations on packed or unpacked data. According to this aspect ofthe invention, the storage area used for storing the data is notcritical. However, embodiments of the register file 150 are laterdescribed with reference to FIGS. 2 a-2 b

Execution unit 130 is coupled to cache 160 and decoder 165. Cache 160 isused to cache data and/or control signals from, for example, main memory104. Decoder 165 is used for decoding instructions received by processor109 into control signals and/or microcode entry points. These controlsignals and/or microcode entry points may be forwarded from the decoder165 to the execution unit 130.

In response to these control signals and/or microcode entry points,execution unit 130 performs the appropriate operations. For example, ifan LCSZC instruction is received, decoder 165 causes execution unit 130to perform the required comparison logic. For at least some embodiments(such as those not implementing fused “test and branch” operations), theexecution unit 130 may set the zero and carry flags accordingly (see,e.g., logical compare circuitry 145). For such embodiments, a branchunit (not shown) of the processor 109 may utilize the flags duringexecution of a subsequent branch instruction that indicates a targetcode location.

Alternatively, the execution unit 130 itself may include branchcircuitry (not shown) that effects a branch based on the logicalcomparisons. For such embodiment, “branching support” provided by anLCSZC instruction is a control jump to a specified target code location,rather than the setting of control flags. For at least one embodiment,the branch circuitry that performs the jump, or “branch”, may be part ofthe logical compare circuitry 145).

Decoder 165 may be implemented using any number of different mechanisms(e.g., a look-up table, a hardware implementation, a PLA, etc.). Thus,while the execution of the various instructions by the decoder 165 andexecution unit 130 may be represented herein by a series of if/thenstatements, it is understood that the execution of an instruction doesnot require a serial processing of these if/then statements. Rather, anymechanism for logically performing this if/then processing is consideredto be within the scope of the invention.

FIG. 1 a additionally shows a data storage device 107(e.g., a magneticdisk, optical disk, and/or other machine readable media) can be coupledto computer system 100. In addition, the data storage device 107 isshown to include code 195 for execution by the processor 109. The code195 can include one or more embodiments of an LCSZC instruction 142, andcan be written to cause the processor 109 to perform bit testing withthe LCSZC instruction(s) 142 for any number of purposes (e.g., motionvideo compression/decompression, image filtering, audio signalcompression, filtering or synthesis, modulation/demodulation, etc.).

Computer system 100 can also be coupled via interconnect 101 to adisplay device 121 for displaying information to a computer user.Display device 121 can include a frame buffer, specialized graphicsrendering devices, a liquid crystal display (LCD), and/or a flat paneldisplay.

An input device 122, including alphanumeric and other keys, may becoupled to interconnect 101 for communicating information and commandselections to processor 109. Another type of user input device is cursorcontrol 123, such as a mouse, a trackball, a pen, a touch screen, orcursor direction keys for communicating direction information andcommand selections to processor 109, and for controlling cursor movementon display device 121. This input device typically has two degrees offreedom in two axes, a first axis (e.g., x) and a second axis (e.g., y),which allows the device to specify positions in a plane. However, thisinvention should not be limited to input devices with only two degreesof freedom.

Another device that may be coupled to interconnect 101 is a hard copydevice 124 which may be used for printing instructions, data, or otherinformation on a medium such as paper, film, or similar types of media.Additionally, computer system 100 can be coupled to a device for soundrecording, and/or playback 125, such as an audio digitizer coupled to amicrophone for recording information. Further, the device 125 mayinclude a speaker which is coupled to a digital to analog (D/A)converter for playing back the digitized sounds.

Computer system 100 can be a terminal in a computer network (e.g., aLAN). Computer system 100 would then be a computer subsystem of acomputer network. Computer system 100 optionally includes videodigitizing device 126 and/or a communications device 190 (e.g., a serialcommunications chip, a wireless interface, an ethernet chip or a modem,which provides communications with an external device or network). Videodigitizing device 126 can be used to capture video images that can betransmitted to others on the computer network.

For at least one embodiment, the processor 109 supports an instructionset that is compatible with the instruction set used by existingprocessors (such as, e.g., the Intel® Pentium® Processor, Intel®Pentium® Pro processor, Intel® Pentium® II processor, Intel® Pentium®III processor, Intel® Pentium® 4 Processor, Intel® Itanium® processor,Intel® Itanium® 2 processor, or the Intel® Core™ Duo processor)manufactured by Intel Corporation of Santa Clara, Calif. As a result,processor 109 can support existing processor operations in addition tothe operations of the invention. Processor 109 may also be suitable formanufacture in one or more process technologies and by being representedon a machine readable media in sufficient detail, may be suitable tofacilitate said manufacture. While the invention is described below asbeing incorporated into an x86 based instruction set, alternativeembodiments could incorporate the invention into other instruction sets.For example, the invention could be incorporated into a 64-bit processorusing an instruction set other than the x86 based instruction set.

FIG. 1 b illustrates an alternative embodiment of a data processingsystem 102 that implements the principles of the present invention. Oneembodiment of data processing system 102 is an applications processorwith Intel XScale™ technology. It will be readily appreciated by one ofskill in the art that the embodiments described herein can be used withalternative processing systems without departure from the scope of theinvention.

Computer system 102 comprises a processing core 110 capable ofperforming LCSZC operations. For one embodiment, processing core 110represents a processing unit of any type of architecture, including butnot limited to a CISC, a RISC or a VLIW type architecture. Processingcore 110 may also be suitable for manufacture in one or more processtechnologies and by being represented on a machine readable media insufficient detail, may be suitable to facilitate said manufacture.

Processing core 110 comprises an execution unit 130, a set of registerfile(s) 150, and a decoder 165. Processing core 110 also includesadditional circuitry (not shown) which is not necessary to theunderstanding of the present invention.

Execution unit 130 is used for executing instructions received byprocessing core 110. In addition to recognizing typical processorinstructions, execution unit 130 recognizes instructions for performingLCSZC operations on packed and unpacked data formats. The instructionset recognized by decoder 165 and execution unit 130 may include one ormore instructions for LCSZC operations, and may also include otherpacked instructions.

Execution unit 130 is coupled to register file 150 by an internal bus(which may, again, be any type of communication pathway including amulti-drop bus, point-to-point interconnect, etc.). Register file 150represents a storage area of processing core 110 for storinginformation, including data. As previously mentioned, it is understoodthat the storage area used for storing the data is not critical.Execution unit 130 is coupled to decoder 165. Decoder 165 is used fordecoding instructions received by processing core 110 into controlsignals and/or microcode entry points. In response to these controlsignals and/or microcode entry points. These control signals and/ormicrocode entry points may be forwarded to the execution unit 130. Theexecution unit 130 may perform the appropriate operations, responsive toreceipt of the control signals and/or microcode entry points. For atleast one embodiment, for example, the execution unit 130 may performthe logical comparisons described herein and may also set the statusflags as discussed herein or branch to a specified code location, orboth.

Processing core 110 is coupled with bus 214 for communicating withvarious other system devices, which may include but are not limited to,for example, synchronous dynamic random access memory (SDRAM) control271, static random access memory (SRAM) control 272, burst flash memoryinterface 273, personal computer memory card international association(PCMCIA)/compact flash (CF) card control 274, liquid crystal display(LCD) control 275, direct memory access (DMA) controller 276, andalternative bus master interface 277.

For at least one embodiment, data processing system 102 may alsocomprise an I/O bridge 290 for communicating with various I/O devicesvia an I/O bus 295. Such I/O devices may include but are not limited to,for example, universal asynchronous receiver/transmitter (UART) 291,universal serial bus (USB) 292, Bluetooth wireless UART 293 and I/Oexpansion interface 294. As with the other buses discussed above, I/Obus 295 may be any type of communication pathway, include a multi-dropbus, point-to-point interconnect, etc.

At least one embodiment of data processing system 102 provides formobile, network and/or wireless communications and a processing core 110capable of performing LCSZC operations on both packed and unpacked data.Processing core 110 may be programmed with various audio, video, imagingand communications algorithms including discrete transformations,filters or convolutions; compression/decompression techniques such ascolor space transformation, video encode motion estimation or videodecode motion compensation; and modulation/demodulation (MODEM)functions such as pulse coded modulation (PCM).

FIG. 1 c illustrates alternative embodiments of a data processing system103 capable of performing LCSZC operations on packed and unpacked data.In accordance with one alternative embodiment, data processing system103 may include a chip package 310 that includes main processor 224, andone or more coprocessors 226. The optional nature of additionalcoprocessors 226 is denoted in FIG. 1 c with broken lines. One or moreof the coprocessors 226 may be, for example, a graphics co-processorcapable of executing SIMD instructions.

FIG. 1 c illustrates that the data processor system 103 may also includea cache memory 278 and an input/output system 265, both coupled to thechip package 310. The input/output system 295 may optionally be coupledto a wireless interface 296.

Coprocessor 226 is capable of performing general computationaloperations and is also capable of performing SIMD operations. For atleast one embodiment, the coprocessor 226 is capable of performing LCSZCoperations on packed and unpacked data.

For at least one embodiment, coprocessor 226 comprises an execution unit130 and register file(s) 209. At least one embodiment of main processor224 comprises a decoder 165 to recognize and decode instructions of aninstruction set that includes LCSZC instructions for execution byexecution unit 130. For alternative embodiments, coprocessor 226 alsocomprises at least part of decoder 166 to decode instructions of aninstruction set that includes LCSZC instructions. Data processing system103 also includes additional circuitry (not shown) which is notnecessary to the understanding of the present invention.

In operation, the main processor 224 executes a stream of dataprocessing instructions that control data processing operations of ageneral type including interactions with the cache memory 278, and theinput/output system 295. Embedded within the stream of data processinginstructions are coprocessor instructions. The decoder 165 of mainprocessor 224 recognizes these coprocessor instructions as being of atype that should be executed by an attached coprocessor 226.Accordingly, the main processor 224 issues these coprocessorinstructions (or control signals representing the coprocessorinstructions) on the coprocessor interconnect 236 where from they arereceived by any attached coprocessor(s). For the single-coprocessorembodiment illustrated in FIG. 1 c, the coprocessor 226 accepts andexecutes any received coprocessor instructions intended for it. Thecoprocessor interconnect may be any type of communication pathway,including a multi-drop bus, point-to-pointer interconnect, or the like.

Data may be received via wireless interface 296 for processing by thecoprocessor instructions. For one example, voice communication may bereceived in the form of a digital signal, which may be processed by thecoprocessor instructions to regenerate digital audio samplesrepresentative of the voice communications. For another example,compressed audio and/or video may be received in the form of a digitalbit stream, which may be processed by the coprocessor instructions toregenerate digital audio samples and/or motion video frames.

For at least one alternative embodiment, main processor 224 and acoprocessor 226 may be integrated into a single processing corecomprising an execution unit 130, register file(s) 209, and a decoder165 to recognize instructions of an instruction set that includes LCSZCinstructions for execution by execution unit 130.

FIG. 2 a illustrates the register file of the processor according to oneembodiment of the invention. The register file 150 may be used forstoring information, including control/status information, integer data,floating point data, and packed data. One of skill in the art willrecognize that the foregoing list of information and data is notintended to be an exhaustive, all-inclusive list.

For the embodiment shown in FIG. 2 a, the register file 150 includesinteger registers 201, registers 209, status registers 208, andinstruction pointer register 211. Status registers 208 indicate thestatus of processor 109, and may include various status registers suchas a zero flag and a carry flag. Instruction pointer register 211 storesthe address of the next instruction to be executed. Integer registers201, registers 209, status registers 208, and instruction pointerregister 211 are all coupled to internal interconnect 170. Additionalregisters may also be coupled to internal interconnect 170. The internalinterconnect 170 may be, but need not necessarily be, a multi-drop bus.The internal interconnect 170 may instead may be any other type ofcommunication pathway, including a point-to-point interconnect.

For one embodiment, the registers 209 may be used for both packed dataand floating point data. In one such embodiment, the processor 109, atany given time, treats the registers 209 as being either stackreferenced floating point registers or non-stack referenced packed dataregisters. In this embodiment, a mechanism is included to allow theprocessor 109 to switch between operating on registers 209 as stackreferenced floating point registers and non-stack referenced packed dataregisters. In another such embodiment, the processor 109 maysimultaneously operate on registers 209 as non-stack referenced floatingpoint and packed data registers. As another example, in anotherembodiment, these same registers may be used for storing integer data.

Of course, alternative embodiments may be implemented to contain more orless sets of registers. For example, an alternative embodiment mayinclude a separate set of floating point registers for storing floatingpoint data. As another example, an alternative embodiment may includinga first set of registers, each for storing control/status information,and a second set of registers, each capable of storing integer, floatingpoint, and packed data. As a matter of clarity, the registers of anembodiment should not be limited in meaning to a particular type ofcircuit. Rather, a register of an embodiment need only be capable ofstoring and providing data, and performing the functions describedherein.

The various sets of registers (e.g., the integer registers 201, theregisters 209) may be implemented to include different numbers ofregisters and/or to different size registers. For example, in oneembodiment, the integer registers 201 are implemented to storethirty-two bits, while the registers 209 are implemented to store eightybits (all eighty bits are used for storing floating point data, whileonly sixty-four are used for packed data). In addition, registers 209may contain eight registers, R_(O) 212 a through R₇ 212 h. R₁ 212 b, R₂212 c and R₃ 212 d are examples of individual registers in registers209. Thirty-two bits of a register in registers 209 can be moved into aninteger register in integer registers 201. Similarly, a value in aninteger register can be moved into thirty-two bits of a register inregisters 209. In another embodiment, the integer registers 201 eachcontain 64 bits, and 64 bits of data may be moved between the integerregister 201 and the registers 209. In another alternative embodiment,the registers 209 each contain 64 bits and registers 209 containssixteen registers. In yet another alternative embodiment, registers 209contains thirty-two registers.

FIG. 2 b illustrates the register file of the processor according to onealternative embodiment of the invention. The register file 150 may beused for storing information, including control/status information,integer data, floating point data, and packed data. In the embodimentshown in FIG. 2 b, the register file 150 includes integer registers 201,registers 209, status registers 208, extension registers 210, andinstruction pointer register 211. Status registers 208, instructionpointer register 211, integer registers 201, registers 209, are allcoupled to internal interconnect 170. Additionally, extension registers210 are also coupled to internal interconnect 170. The internalinterconnect 170 may be, but need not necessarily be, a multi-drop bus.The internal interconnect 170 may instead may be any other type ofcommunication pathway, including a point-to-point interconnect.

For at least one embodiment, the extension registers 210 are used forboth packed integer data and packed floating point data. For alternativeembodiments, the extension registers 210 may be used for scalar data,packed Boolean data, packed integer data and/or packed floating pointdata. Of course, alternative embodiments may be implemented to containmore or less sets of registers, more or less registers in each set ormore or less data storage bits in each register without departing fromthe broader scope of the invention.

For at least one embodiment, the integer registers 201 are implementedto store thirty-two bits, the registers 209 are implemented to storeeighty bits (all eighty bits are used for storing floating point data,while only sixty-four are used for packed data) and the extensionregisters 210 are implemented to store 128 bits. In addition, extensionregisters 210 may contain eight registers, XR₀ 213 a through XR₇ 213 h.XR₀ 213 a, XR₁ 213 b and XR₂ 213 c are examples of individual registersin registers 210. For another embodiment, the integer registers 201 eachcontain 64 bits, the extension registers 210 each contain 64 bits andextension registers 210 contains sixteen registers. For one embodimenttwo registers of extension registers 210 may be operated upon as a pair.For yet another alternative embodiment, extension registers 210 containsthirty-two registers.

FIG. 3 illustrates a flow diagram for one embodiment of a process 300 tomanipulate data according to one embodiment of the invention. That is,FIG. 3 illustrates the process followed, for example, by processor 109(see, e.g., FIG. 1 a) while performing a LCSZC operation on packed data,performing a LCSZC operation on unpacked data, or performing some otheroperation. Process 300 and other processes herein disclosed areperformed by processing blocks that may comprise dedicated hardware orsoftware or firmware operation codes executable by general purposemachines or by special purpose machines or by a combination of both.

FIG. 3 illustrates that processing for the method begins at “Start” andproceeds to processing block 301. At processing block 301, the decoder165 (see, e.g., FIG. 1 a) receives a control signal from either thecache 160 (see, e.g., FIG. 1 a) or interconnect 101 (see, e.g., FIG. 1a). The control signal received at block 301 may be, for at least oneembodiment, a type of control signal commonly referred to as a software“instruction.” Decoder 165 decodes the control signal to determine theoperations to be performed. Processing proceeds from processing block301 to processing block 302.

At processing block 302, decoder 165 accesses the register file 150(FIG. 1 a), or a location in memory (see, e.g., main memory 104 or cachememory 160 of FIG. 1 a). Registers in the register file 150, or memorylocations in the memory, are accessed depending on the register addressspecified in the control signal. For example, the control signal for anoperation can include SRC1, SRC2 and DEST register addresses. SRC1 isthe address of the first source register. SRC2 is the address of thesecond source register. In some cases, the SRC2 address is optional asnot all operations require two source addresses. If the SRC2 address isnot required for an operation, then only the SRC1 address is used. DESTis the address of the destination register where the result data isstored. For at least one embodiment, SRC1 or SRC2 may also used as DESTin at least one of the control signals recognized by the decoder 165.

The data stored in the corresponding registers is referred to asSource1, Source2, and Result respectively. In one embodiment, each ofthese data may be sixty-four bits in length. For alternativeembodiments, one or more of these data may be other lengths, such as onehundred twenty-eight bits in length.

For another embodiment of the invention, any one, or all, of SRC1, SRC2and DEST, can define a memory location in the addressable memory spaceof processor 109 (FIG. 1 a) or processing core 110 (FIG. 1 b). Forexample, SRC1 may identify a memory location in main memory 104, whileSRC2 identifies a first register in integer registers 201 and DESTidentifies a second register in registers 209. For simplicity of thedescription herein, the invention will be described in relation toaccessing the register file 150. However, one of skill in the art willrecognize that these described accesses may be made to memory instead.

From block 302, processing proceeds to processing block 303. Atprocessing block 303, execution unit 130 (see, e.g., FIG. 1 a) isenabled to perform the operation on the accessed data.

Processing proceeds from processing block 303 to processing block 304.At processing block 304, the result is stored back into register file150 or memory according to requirements of the control signal.Processing then ends at “Stop”.

Data Storage Formats

FIG. 4 illustrates packed data-types according to one embodiment of theinvention. Four packed and one unpacked data formats are illustrated,including packed byte 421, packed half 422, packed single 423 packeddouble 424, and unpacked double quadword 412.

The packed byte format 421, for at least one embodiment, is one hundredtwenty-eight bits long containing sixteen data elements (B0-B15). Eachdata element (B0-B15) is one byte (e.g., 8 bits) long.

The packed half format 422, for at least one embodiment, is one hundredtwenty-eight bits long containing eight data elements (Half 0 throughHalf 7). Each of the data elements (Half 0 through Half 7) may holdsixteen bits of information. Each of these sixteen-bit data elements maybe referred to, alternately, as a “half word” or “short word” or simply“word.”

The packed single format 423, for at least one embodiment, may be onehundred twenty-eight bits long and may hold four 423 data elements(Single 0 through Single 3). Each of the data elements (Single 0 throughSingle 3) may hold thirty-two bits of information. Each of the 32-bitdata elements may be referred to, alternatively, as a “dword” or “doubleword”. Each of the data elements (Single 0 through Single 3) mayrepresent, for example, a 32-bit single precision floating point value,hence the term “packed single” format.

The packed double format 424, for at least one embodiment, may be onehundred twenty-eight bits long and may hold two data elements. Each dataelement (Double 0, Double 1) of the packed double format 424 may holdsixty-four bits of information. Each of the 64-bit data elements may bereferred to, alternatively, as a “qword” or “quadword”. Each of the dataelements (Double 0, Double 1) may represent, for example, a 64-bitdouble precision floating point value, hence the term “packed double”format.

The unpacked double quadword format 412 may hold up to 128 bits of data.The data need not necessarily be packed data. For at least oneembodiment, for example, the 128 bits of information of the unpackeddouble quadword format 412 may represent a single scalar datum, such asa character, integer, floating point value, or binary bit-mask value.Alternatively, the 128 bits of the unpacked double quadword format 412may represent an aggregation of unrelated bits (such as a statusregister value where each bit or set of bits represents a differentflag), or the like.

For at least one embodiment of the invention, the data elements of thepacked single 423 and packed double 424 formats may be packed floatingpoint data elements as indicated above. In an alternative embodiment ofthe invention, the data elements of the packed single 423 and packeddouble 424 formats may be packed integer, packed Boolean or packedfloating point data elements. For another alternative embodiment of theinvention, the data elements of packed byte 421, packed half 422, packedsingle 423 and packed double 424 formats may be packed integer or packedBoolean data elements. For alternative embodiments of the invention, notall of the packed byte 421, packed half 422, packed single 423 andpacked double 424 data formats may be permitted or supported.

FIGS. 5 and 6 illustrate in-register packed data storage representationsaccording to at least one embodiment of the invention.

FIG. 5 illustrates unsigned and signed packed byte in-register formats510 and 511, respectively. Unsigned packed byte in-registerrepresentation 510 illustrates the storage of unsigned packed byte data,for example in one of the 128-bit extension registers XR₀ 213 a throughXR₇ 213 h (see, e.g., FIG. 2 b). Information for each of sixteen bytedata elements is stored in bit seven through bit zero for byte zero, bitfifteen through bit eight for byte one, bit twenty-three through bitsixteen for byte two, bit thirty-one through bit twenty-four for bytethree, bit thirty-nine through bit thirty-two for byte four, bitforty-seven through bit forty for byte five, bit fifty-five through bitforty-eight for byte six, bit sixty-three through bit fifty-six for byteseven, bit seventy-one through bit sixty-four for byte eight, bitseventy-nine through bit seventy-two for byte nine, bit eighty-seventhrough bit eighty for byte ten, bit ninety-five through biteighty-eight for byte eleven, bit one hundred three through bitninety-six for byte twelve, bit one hundred eleven through bit onehundred four for byte thirteen, bit one hundred nineteen through bit onehundred twelve for byte fourteen and bit one hundred twenty-seventhrough bit one hundred twenty for byte fifteen.

Thus, all available bits are used in the register. This storagearrangement increases the storage efficiency of the processor. As well,with sixteen data elements accessed, one operation can now be performedon sixteen data elements simultaneously.

Signed packed byte in-register representation 511 illustrates thestorage of signed packed bytes. Note that the eighth (MSB) bit of everybyte data element is the sign indicator (“s”).

FIG. 5 also illustrates unsigned and signed packed word in-registerrepresentations 512 and 513, respectively.

Unsigned packed word in-register representation 512 shows how extensionregisters 210 store eight word (16 bits each) data elements. Word zerois stored in bit fifteen through bit zero of the register. Word one isstored in bit thirty-one through bit sixteen of the register. Word twois stored in bit forty-seven through bit thirty-two of the register.Word three is stored in bit sixty-three through bit forty-eight of theregister. Word four is stored in bit seventy-nine through bit sixty-fourof the register. Word five is stored in bit ninety-five through biteighty of the register. Word six is stored in bit one hundred eleventhrough bit ninety-six of the register. Word seven is stored in bit onehundred twenty-seven through bit one hundred twelve of the register.

Signed packed word in-register representation 513 is similar to unsignedpacked word in-register representation 512. Note that the sign bit (“s”)is stored in the sixteenth bit (MSB) of each word data element.

FIG. 6 illustrates unsigned and signed packed doubleword in-registerformats 514 and 515, respectively. Unsigned packed doublewordin-register representation 514 shows how extension registers 210 storefour doubleword (32 bits each) data elements. Doubleword zero is storedin bit thirty-one through bit zero of the register. Doubleword one isstored in bit sixty-three through bit thirty-two of the register.Doubleword two is stored in bit ninety-five through bit sixty-four ofthe register. Doubleword three is stored in bit one hundred twenty-seventhrough bit ninety-six of the register.

Signed packed double-word in-register representation 515 is similar tounsigned packed quadword in-register representation 516. Note that thesign bit (“s”) is the thirty-second bit (MSB) of each doubleword dataelement.

FIG. 6 also illustrates unsigned and signed packed quadword in-registerformats 516 and 517, respectively. Unsigned packed quadword in-registerrepresentation 516 shows how extension registers 210 store two quadword(64 bits each) data elements. Quadword zero is stored in bit sixty-threethrough bit zero of the register. Quadword one is stored in bit onehundred twenty-seven through bit sixty-four of the register.

Signed packed quadword in-register representation 517 is similar tounsigned packed quadword in-register representation 516. Note that thesign bit (“s”) is the sixty-fourth bit (MSB) of each quadword dataelement.

Logical Compare-and-Swap, Set-Zero-and-Carry-Flags Operation(s)

For at least one embodiment of the invention, the SRC1 register may holdpacked data or an unpacked double quadword of data (Source1) and theDEST register may also hold packed data or an unpacked double quadwordof data (Dest). The Dest value in the DEST register or the Source1 valuein the SRC1 register, for at least one embodiment, may be a doublequadword of unpacked data to be used as a bitwise mask value.

Generally, in the first step of the LCSZC instruction, two compareoperations are preformed. A first intermediate result is generated byperforming an independent logical comparison (bitwise AND operation) ofeach bit in Source1 with the respective bit of Dest. A secondintermediate result is generated by performing an independent logicalcomparison (bitwise AND operation) of each bit in Source1 with thecomplement of the respective bit of Dest. These intermediate results maybe stored in temporary storage locations (such as, e.g., a register), ormay not be stored by the processor at all.

FIG. 7 a is a flow diagram for a general method 700 for performing LCSZCoperations according to at least one embodiment of the invention.Process 700 and other processes herein disclosed are performed byprocessing blocks that may comprise dedicated hardware or software orfirmware operation codes executable by general purpose machines or byspecial purpose machines or by a combination of both. FIGS. 7 a through7 d are discussed in the following paragraphs with reference to FIG. 1a.

FIG. 7 a illustrates that the method 700 begins at “Start” and proceedsto processing block 701. At processing block 701, decoder 165 decodesthe control signal received by processor 109. Thus, decoder 165 decodesthe operation code for a LCSZC instruction. Processing then proceedsfrom processing block 701 to processing block 702.

At processing block 702, via internal bus 170, decoder 165 accessesregisters 209 in register file 150 given the SRC1 and DEST addressesencoded in the instruction. For at least one embodiment, the addressesthat are encoded in the instruction each indicate an extension register(see, e.g., extension registers 210 of FIG. 2 b). For such embodiment,the indicated extension registers 210 are accessed at block 702 in orderto provide execution unit 130 with the data stored in the SRC1 register(Source1), and the data stored in the DEST register (Dest). For at leastone embodiment, extension registers 210 communicate the data toexecution unit 130 via internal bus 170.

From processing block 702, processing proceeds to processing block 703.At processing block 703, decoder 165 enables execution unit 130 toperform the instruction. For at least one embodiment, such enabling 703is performed by sending one or more control signals to the executionunit to indicate the desired operation (LCZCS). From block 703,processing proceeds to processing blocks 714 and 715. While blocks 714and 715 are shown in parallel, one of skill in the art will recognizethat such operations need be performed exactly simultaneously as long asthey are performed in the same cycle or set of cycles and that, for atleast one alternative embodiment, the processing of blocks 714 and 715may be performed serially. Different embodiments thus may perform theprocessing of blocks 714 and 715 in parallel, in series, or in somecombination of serial and parallel operations.

At processing block 714, the following is performed. All or some ofSource1 bits are logically AND'ed with the same respective bits of theDest value. Similarly, at processing block 715, all or some of Source1bits are logically AND'ed with the complement of the same respectivebits of the Dest value.

From block 714, processing proceeds to block 720. From block 715,processing proceeds to block 721.

At processing block 720, the state of the processor is modified based onthe results of the comparison performed at processing block 714.Similarly, at processing block 721 the state of the processor ismodified based on the results of the comparison preformed at processingblock 715. One of skill in the art will note that the method 700illustrated in FIG. 7 a is non-destructive, in that neither the Source1nor Dest operand values are modified as a result of the LCSZC operation.Instead, the zero flag is modified at block 720 and the carry flag ismodified at block 721.

At processing block 720, the value of the zero flag is set to a truevalue (e.g., a logic-high value), if all bits of Intermediate Result 1are equal to zero (e.g., a logic-low value). If, however, even one bitof the Intermediate Result 1 is a logic-high value, then the zero flagis set to a false value (e.g., logic-low value) at block 720.

At processing block 721, the value of the carry flag is set to a truevalue (e.g., a logic-high value), if all bits of Intermediate Result 2are equal to zero (e.g., a logic-low value). If, however, even one bitof the Intermediate Result 2 is a logic-high value, then the carry flagis set to a false value (e.g., logic-low value) at block 721.

It will be appreciated that alternative embodiments of process 700 mayimplement only processing blocks 714 and 720, but not processing blocks715 and 721, or only processing blocks 715 and 721, but not processingblocks 714 and 720. It will also be appreciated that alternativeembodiments of process 700 may implement additional processing blocks tosupport additional variations of the LCSZC instructions.

From blocks 720 and 721, processing may optionally proceed to block 722.At block 722, other state bits within the processor may be modified. Forat least one embodiment, these state bits may include, for example, oneor more other architecturally visible status flag values. These flagsmay be one- or two-bit values and may include parity (PF), auxiliarycarry (AF), sign (SF), trap (TF), interrupt enable/disable (IF),direction (DF), overflow (OF), I/O privilege level (IOPL), nested task(NT), resume (RF), virtual 8086 mode (VM), alignment check (AC), virtualinterrupt (VIF), virtual interrupt pending (FIP), and CPU identifier(ID) flags and the like. Of course, the preceding listing of specificflags is intended to be illustrative only; other embodiments may includefewer, more, or different flags.

From optional block 722, processing ends at “End.” For embodiments thatdo not include optional block 722, processing ends at “End” after theprocessing at blocks 720 and 721.

FIG. 7 b illustrates a flow diagram for at least one specific embodiment700 b of the general method 700 illustrated in FIG. 7 a. For thespecific embodiment 700 b illustrated in FIG. 7 b, the LCSZC operationis performed on Source1 and Dest data values that are 128 bits inlength, and which may or may not be packed data. (Of course, one ofskill in the art will recognize that the operations illustrated in FIG.7 b may also be performed for data values of other lengths, includingthose that are smaller or larger than 128 bits).

Processing blocks 701 b through 703 b operate essentially the same formethod 700 b as do processing blocks 701 through 703 that are describedabove in connection with method 700, illustrated in FIG. 7 a. Whendecoder 165 enables execution unit 130 to perform the instruction atblock 703 c, the instruction is an LCSZC instruction for performinglogical AND comparisons of respective bits of the Source1 and Destvalues. (See, e.g., signed packed doubleword in-register representation515 illustrated in FIG. 6). Such instruction may be referred to by aninstruction mnemonic that may be used by application programmers, suchas “PTEST”. From block 703 c, processing proceeds to blocks 714 c and715 c. Again, blocks 714 c and 715 c may be, but need not necessarilybe, performed in parallel.

From processing block 703 b, processing proceeds to processing blocks714 b and 715 b. As indicated above in connection with processing blocks714 and 715 of FIG. 7 a, it should be noted again that, although blocks714 b and 715 b are illustrated in FIG. 7 b as being performed inparallel, the invention should be construed to be limited in thisregard. Instead, different embodiments may perform the processing ofblocks 714 b and 715 b in parallel, in series, or in some combination ofserial and parallel operations.

At processing block 714 b, the following is performed. All of Source1bits are logically AND'ed with the same respective bits of the Destvalue. That is, bits [127:0] of Intermediate Result 1 are assigned theresult of bitwise AND operations of the respective bits of Source1[127:0] with Dest [127:0].

Similarly, at processing block 715 b, all of Source1 bits are logicallyAND'ed with the complement of the same respective bits of the Destvalue. That is, bits [127:0] of Intermediate Result 2 are assigned theresult of bitwise AND operations of the bits of Source1 [127:0] with therespective complemented bits of Dest [127:0].

From block 714 b, processing proceeds to block 720 b. From block 715 b,processing proceeds to block 721 b.

At processing block 720 b, the state of the processor is modified basedon the results of the comparison performed at processing block 714 b.Similarly, at processing block 721 b the state of the processor ismodified based on the results of the comparison preformed at processingblock 715 b. One of skill in the art will note that the method 700 billustrated in FIG. 7 b is non-destructive, in that neither the Source1nor Dest operand values are modified as a result of the LCSZC operation.Instead, the zero flag is modified at block 720 b and the carry flag ismodified at block 721 b.

At processing block 720 b, the value of the zero flag is set to a truevalue (e.g., a logic-high value), if all bits of Intermediate Result 1(e.g., bits [127:0] of Intermediate Result 1) are equal to zero (e.g., alogic-low value). If, however, even one bit of the Intermediate Result 1is a logic-high value, then the zero flag is set to a false value (e.g.,logic-low value) at block 720 b.

At processing block 721 b, the value of the carry flag is set to a truevalue (e.g., a logic-high value), if all bits of Intermediate Result 2(e.g., bits [127:0] of Intermediate Result 2) are equal to zero (e.g., alogic-low value). If, however, even one bit of the Intermediate Result 2is a logic-high value, then the carry flag is set to a false value(e.g., logic-low value) at block 721 b.

It will be appreciated that alternative embodiments of process 700 b mayimplement only processing block 714 b and 720 b and not processing block715 b and 721 b, or only processing blocks 715 b and 721 b and notprocessing blocks 714 b and 720 b. It will also be appreciated thatalternative embodiments of process 700 b may implement additionalprocessing blocks to support additional variations of the LCSZCinstructions.

From blocks 720 b and 721 b, processing may optionally proceed to block722 b. At block 722 b, other state bits within the processor may bemodified. For the embodiment illustrated in FIG. 7 b, the AF (auxiliarycarry), OF (overflow), PF (parity) and SF (sign) flags are assigned to alogic-low value at block 722 b.

From optional block 722 b, processing ends at “End.” For embodimentsthat do not include optional block 722 b, processing ends at “End” afterthe processing at blocks 720 b and 721 b.

It will be appreciated that alternative embodiments of processing blocks714, 714 b, 715, or 715 b may perform logical comparison operations onsigned or unsigned data elements or on a combination of both.

FIG. 7 c illustrates a flow diagram for at least one alternativespecific embodiment 700 c of the general method 700 illustrated in FIG.7 a. For the specific embodiment 700 c illustrated in FIG. 7 c, theLCSZC operation is performed on Source1 and Dest data values that are128 bits in length. The source or destination operand, or both, may bepacked, in that the 128-bit data value of the source operand representsfour packed 32-bit (“doubleword”) data elements. The data elements mayeach represent, for example, thirty-two bit signed single-precisionfloating point values.

Of course, one of skill in the art will recognize that the operationsillustrated in FIG. 7 c may also be performed for data values of otherlengths, including those that are smaller or larger than 128 bits andfor other sizes of data elements, including bytes (8 bits) and/or shortwords (16 bits).

Processing blocks 701 c through 703 c operate essentially the same formethod 700 c as do processing blocks 701 through 703 that are describedabove in connection with method 700, illustrated in FIG. 7 a. Anexception to the foregoing statement is that, for processing block 703c, when decoder 165 enables execution unit 130 to perform theinstruction, the instruction is a LCSZC instruction for performinglogical AND comparisons of the MSB of each 32-bit doubleword of theSource1 and Destination values. (See, e.g., signed packed doublewordin-register representation 515 illustrated in FIG. 6). Such instructionmay be referred to by an instruction mnemonic to be used by programmers,such as “TESTPS”, where “PS” indicates Packed Single-precision dataelements.

From block 703 c, processing proceeds to blocks 714 c and 715 c. Again,blocks 714 c and 715 c may be, but need not necessarily be, performed inparallel.

At processing block 714 c, the following is performed. All of Source1bits are logically AND'ed with the same respective bits of the Destvalue. That is, bits [127:0] of Intermediate Result 1 are assigned theresult of bitwise AND operations of the respective bits of Source1[127:0] with Dest [127:0].

Similarly, at processing block 715 c, all of Source1 bits are logicallyAND'ed with the complement of the same respective bits of the Destvalue. That is, bits [127:0] of Intermediate Result 2 are assigned theresult of bitwise AND operations of the bits of Source1 [127:0] with therespective complemented bits of Dest [127:0].

From block 714 c, processing proceeds to block 720 c. From block 715 c,processing proceeds to block 721 c.

At block 720 c, the MSB of each 32-bit double-word of the firstintermediate value, Intermediate Value 1, is determined. If bits 127,95, 63 and 31 of Intermediate Value 1 are equal to zero, then the zeroflag is set to a logic-high value at block 720 c. Otherwise, the zeroflag is set to a logic-low value at block 720 c.

Similarly, at block 721 c, the MSB of each 32-bit double-word of thesecond intermediate value, Intermediate Value 2, is determined. If bits127, 95, 63 and 31 of Intermediate Value 2 are equal to zero, then thecarry flag is set to a logic-high value at block 721 c. Otherwise, thecarry flag is set to a logic-low value at block 721 c. Neither theoriginal value (Source1) of the source register (SRC1) nor the originalvalue (Dest) of the destination register (DEST) is modified as a resultof the processing of the method 700 c.

From block 720 c and 721 c, processing proceeds either to “End” or tooptional processing block 722 c. At block 722 c, other state bits withinthe processor may be modified. For the embodiment illustrated in FIG. 7c, the AF (auxiliary carry), OF (overflow), PF (parity) and SF (sign)flags are assigned to a logic-low value at block 722 c.

For embodiments that do not include optional block 722 c, processingends at “End” after the processing at blocks 720 c and 721 c. Forembodiments that do include optional block 722 c, processing ends aftercompletion of the processing block 722 c.

FIG. 7 d illustrates a flow diagram for at least one alternativespecific embodiment 700 d of the general method 700 illustrated in FIG.7 a. For the specific embodiment 700 d illustrated in FIG. 7 d, theLCSZC operation is performed on Source1 and Dest data values that are128 bits in length. The source or destination operand, or both, may bepacked, in that the 128-bit data value of the source operand representstwo packed 64-bit data elements. The data elements may each represent,for example, sixty-four bit signed double-precision floating pointvalues.

Of course, one of skill in the art will recognize that the operationsillustrated in FIG. 7 d may also be performed for data values of otherlengths, including those that are smaller or larger than 128 bits andfor other sizes of data elements, including bytes (8 bits) and/or shortwords (16 bits).

Processing blocks 701 d through 703 d operate essentially the same formethod 700 c as do processing blocks 701 through 703 that are describedabove in connection with method 700, illustrated in FIG. 7 a. Anexception to the foregoing statement is that, for processing block 703d, when decoder 165 enables execution unit 130 to perform theinstruction, the instruction is a LCSZC instruction for performinglogical AND comparisons of the MSB of each 64-bit double-word of theSource1 and Destination values. (See, e.g., signed packed quadwordin-register representation 517 illustrated in FIG. 6). Such instructionmay be referred to by an instruction mnemonic to be used by programmers,such as “TESTPD”, where “PD” indicates Packed Double-precision dataelements.

From block 703 d, processing proceeds to blocks 714 d and 715 d. Again,blocks 714 d and 715 d may be, but need not necessarily be, performed inparallel.

At processing block 714 d, the following is performed. All of Source1bits are logically AND'ed with the same respective bits of the Destvalue. That is, bits [127:0] of Intermediate Result 1 are assigned theresult of bitwise AND operations of the respective bits of Source1[127:0] with Dest [127:0].

Similarly, at processing block 715 d, all of Source1 bits are logicallyAND'ed with the complement of the same respective bits of the Destvalue. That is, bits [127:0] of Intermediate Result 2 are assigned theresult of bitwise AND operations of the bits of Source1 [127:0] with therespective complemented bits of Dest [127:0].

From block 714 d, processing proceeds to block 720 d. From block 715 d,processing proceeds to block 721 d.

At block 720 d, the MSB of each 64-bit quadword of the firstintermediate value, Intermediate Value 1, is determined. If bits 127 and63 of Intermediate Value 1 are equal to zero, then the zero flag is setto a logic-high value at block 720 d. Otherwise, the zero flag is set toa logic-low value at block 720 d.

Similarly, at block 721 d, the MSB of each 64-bit quadword of the secondintermediate value, Intermediate Value 2, is determined. If bits 127 and63 of Intermediate Value 2 are equal to zero, then the carry flag is setto a logic-high value at block 721 d. Otherwise, the carry flag is setto a logic-low value at block 721 d. Neither the original value(Source1) of the source register (SRC1) nor the original value (Dest) ofthe destination register (DEST) is modified as a result of theprocessing of the method 700 d.

From block 720 d and 721 d, processing proceeds either to “End” or tooptional processing block 722 d. At block 722 d, other state bits withinthe processor may be modified. For the embodiment illustrated in FIG. 7d, the AF (auxiliary carry), OF (overflow), PF (parity) and SF (sign)flags are assigned to a logic-low value at block 722 d.

For embodiments that do not include optional block 722 d, processingends at “End” after the processing at blocks 720 d and 721 d. Forembodiments that do include optional block 722 c, processing ends aftercompletion of the processing block 722 c.

Logical-Compare, Set-Zero-and-Carry Flag Circuits

For at least some embodiments, various of the LCSZC instructions forpacked data (e.g., TESTPS and TESTPD, discussed above) can execute onmultiple data elements in the same number of clock cycles as a compareoperation on unpacked data. To achieve execution in the same number ofclock cycles, parallelism may be used. That is, elements of a processor(such as registers and execution units) may be simultaneously instructedto perform the LCSZC operations on the data elements. This paralleloperation is discussed in more detail below. FIGS. 8 a and 8 b arediscussed below with reference to FIG. 1 a.

FIG. 8 a illustrates a circuit 801 for performing LCSZC operations onpacked data according to at least one embodiment of the invention. Thecircuit 801 may be, for at least one embodiment, all or part of thelogical compare circuitry 145 illustrated in FIG. 1 a.

FIG. 8 a depicts a source operand, Source1[127:0] 831, and a destinationoperand, Dest[127:0] 833. For at least one embodiment, the source anddestination are stored in N-bit long SIMD registers, such as for example128-bit Intel® SSE2 XMM registers (see. e.g., extension registers 210 ofFIG. 2 b).

The particular example embodiment illustrated in FIG. 8 a shows a doublequadword (128-bit) embodiment of an LCSZC instruction, where every bitof the 128 bit source and destination operands are compared with theirrespective counterpart. For such embodiment, because each bit iscompared, the operation may operate on, and is functionally agnostic of,any nature of 128 bits in the source and destination operands; either orboth the source and destination operands may be packed data, unpackedscalar data, signed data, or unsigned data. While in some specificexamples packed data sources 831 and destinations 833 may be representedas having 128-bits, it will be appreciated that the principals disclosedherein may be extended to other conveniently selected lengths, such as80-bits, 128-bits or 256-bits.

Operation control 800 outputs signals on Enable 880 to controloperations performed by the circuit 801. One embodiment of operationcontrol 800 may comprise, for example, a decoder 165 and an instructionpointer register 211. Of course, operation control 800 may also compriseadditional circuitry which is not necessary to understanding theinvention. The LCSZC circuit 801 includes two sets (825, 827) of ANDgates, where each set includes one AND gate for each bit of the sourceoperand. Thus, for an embodiment where the source and destination have128 bits, the first set 825 includes 128 AND gates 819 and the secondset 827 includes 128 AND gates 820. Each of the 128 bit values of thesource and destination operands (see, e.g., bit values 854 in FIG. 8 a)is an input to one of the AND gates 819 in the first set 825 and is alsoan input to one of the AND gates 820 of the second set 827. It should benoted that the second set of AND gates 827 receives the inputs from thedestination operand 833 only after it has been inverted to itscomplement value (see inverter logic 844).

The output of each of the AND gates 819 in the first set 825 is an inputinto an NAND gate 854. At least one purpose of NAND gate 854 is todetermine whether the result of AND'ing the bits of the source anddestination has resulted in a value of all zeros (logic-low values) and,if so, to pass a logic-high value to the zero flag 858 in order to setit.

The output of each of the AND gates 820 in the second set 827 is aninput into an NAND gate 856. At least one purpose of NAND gate 856 is todetermine whether the result of AND'ing the bits of the source 831 withthe complement of the bits of the destination 833 has resulted in avalue of all zeros (logic-low values) and, if so, to pass a logic-highvalue to the carry flag 860 in order to set it.

Alternative embodiments of double quadword LCSZC instructions mayinclude but are not limited to operations for an unsigned doublequadword value in both the source and destination as well as operationsfor a signed double quadword value in both the source and destination.Other alternative embodiments of LCSZC instructions may includeoperations that apply to other sizes of signed or unsigned data elements(see, e.g., FIG. 8 b for a signed doubleword embodiment and FIG. 8 c fora signed quadword embodiment).

FIG. 8 b illustrates at least one embodiment of a circuit 801 b forperforming LCSZC operations on packed data according to one alternativeembodiment of the invention. Operation control 800 processes the controlsignal for the packed LCSZC instructions. Such a packed LCSZCinstruction may be, for an example, a “TESTPS” instruction thatindicates that an LCSZC operation is to be performed on four packedthirty-two bit values. Each of the packed thirty-two bit values mayrepresent, for example, single-precision floating point values. Itshould be understand that, for such embodiment, it may be that only oneof the operands (e.g., source 831 or destination 833) contains thepacked single precision floating point values. The other operand maycontain, for example, a bit mask.

FIG. 8 a illustrates that operation control 800 outputs signals onEnable 880 to control LCSZC circuit 801 b. [One of skill in the art willrecognize that the LCSZC circuit 801 b illustrated in FIG. 8 b may beimplemented by invoking a subset of the logic elements of LCSZC circuit801 illustrated in FIG. 8 a].

The LCSZC circuit 801 b includes two sets of AND gates, where each setincludes one AND gate for each bit of the source operand that is to becompared with the corresponding bit of the destination operand. For theembodiment illustrated in FIG. 8 b, the most significant bits for eachof four 32-bit (“doubleword”) data elements are to be compared. Thus,the first set of AND gates includes gates 819 ₁ through 819 ₄ and thesecond set of AND gates includes gates 820 ₁ through 820 ₄.

FIG. 8 b illustrates that the value of the MSB for each of the four32-bit data elements in the source operand 831 and each of the four32-bit data elements in the destination operand 833 is an input to oneof the first set of AND gates 819. More specifically, FIG. 8 billustrates that bit 127 of the source operand 831 and destinationoperand 833 are both inputs to gate 819 ₁, bit 93 of the source operand831 and destination operand 833 are both inputs to gate 819 ₂, bit 63 ofthe source operand 831 and destination operand 833 are both inputs togate 819 ₃, and bit 31 of the source operand 831 and destination operand833 are both inputs to gate 819 ₄.

FIG. 8 b further illustrates that the value of the MSB for each of thefour 32-bit data elements in the source operand 831 and each of the four32-bit data elements in the destination operand 833 is an input to oneof the second set of AND gates 820. It should be noted that the secondset of AND gates, 820 ₁ through 820 ₄, receives the inputs from the MSBof each doubleword of the destination operand 833 only after they havebeen inverted to their complement value (see inverters 844 a-844 d).

More specifically, FIG. 8 b illustrates that bit 127 of the sourceoperand 831 and the complement of bit 127 of the destination operand 833are both inputs to gate 820 ₁, bit 93 of the source operand 831 and thecomplement of bit 93 of destination operand 833 are both inputs to gate820 ₂, bit 63 of the source operand 831 and the complement of bit 63 ofthe destination operand 833 are both inputs to gate 820 ₃, and bit 31 ofthe source operand 831 and the complement of bit 31 of the destinationoperand 833 are both inputs to gate 820 ₄.

The output of each of the AND gates 819 ₁ through 819 ₄ is an input intoa NAND gate 855. At least one purpose of NAND gate 855 is to determinewhether the result of AND'ing the most significant bits of each of thefour doublewords of the source and destination has resulted in a valueof all zeros (logic-low values) and, if so, to pass a logic-high valueto the zero flag 858 in order to set it.

The output of each of the AND gates 820 ₁ through 820 ₄ is an input intoNAND gate 859. At least one purpose of NAND gate 859 is to determinewhether the result of AND'ing the bits of the source with the complementof the bits of the destination has resulted in a value of all zeros(logic-low values) and, if so, to pass a logic-high value to the carryflag 860 in order to set it.

Alternative embodiments of a packed LCSZC instruction that compares theMSB for each of four doublewords may include but are not limited tooperations for packed signed doubleword values in one operand and a bitmask in the other operand, unsigned doubleword values in both the sourceand destination, and operations for signed doubleword values in both thesource and destination, or for a combination. Other alternativeembodiments of LCSZC instructions may include operations that apply toother sizes of signed or unsigned data elements.

FIG. 8 c illustrates at least one embodiment of a circuit 810 c forperforming LCSZC operations on packed data according to anotheralternative embodiment of the invention. Operation control 800 processesthe control signal for the packed LCSZC instructions. Such a packedLCSZC instruction may be, for an example, a “TESTPD” instruction thatindicates that an LCSZC operation is to be performed on two packeddouble-precision (64-bit) floating point values. Operation control 800outputs signals on Enable 880 to control LCSZC circuit 801 c. [One ofskill in the art will recognize that the LCSZC circuit 801 c illustratedin FIG. 8 c may be implemented by invoking a subset of the logicelements of LCSZC circuit 801 illustrated in FIG. 8 a].

As with the circuit 801 b discussed above in connection with FIG. 8 b,the LCSZC circuit 801 c includes two sets of AND gates, where each setincludes one AND gate for each bit of the source operand that is to becompared with the corresponding bit of the destination operand. For theembodiment illustrated in FIG. 8 c, the most significant bits for eachof two 64-bit (“quadword”) data elements are to be compared. Thus, thefirst set of AND gates includes gates 819 ₁ and 819 ₃ and the second setof AND gates includes gates 820 ₁ and 820 ₃.

FIG. 8 c illustrates that the value of the MSB for each of the two64-bit data elements in the source operand 831 and for each of the two64-bit data elements in the destination operand 833 is an input to oneof the first set of AND gates (819 ₁ and 819 ₃). More specifically, FIG.8 c illustrates that bit 127 of the source operand 831 and destinationoperand 833 are both inputs to gate 819 ₁ and that bit 63 of the sourceoperand 831 and destination operand 833 are both inputs to gate 819 ₃.

FIG. 8 c further illustrates that the value of the MSB for each of thetwo 64-bit data elements in the source operand 831 and for each of thetwo 64-bit data elements in the destination operand 833 is an input toone of the second set of AND gates (820 ₁ and 820 ₃). It should be notedthat the second set of AND gates, 820 ₁ and 820 ₃, receives the inputsfrom the MSB of each quadword of the destination operand 833 only afterthey have been inverted to their complement value (see inverters 844 aand 844 c).

More specifically, FIG. 8 c illustrates that bit 127 of the sourceoperand 831 and the complement of bit 127 of the destination operand 833are both inputs to gate 820 ₁ and that bit 63 of the source operand 831and the complement of bit 63 of the destination operand 833 are bothinputs to gate 820 ₃.

The output of each of the AND gates 819 ₁ and 819 ₃ is an input into aNAND gate 853. At least one purpose of NAND gate 853 is to determinewhether the result of AND'ing the most significant bits of each of thetwo quadwords of the source and destination are both zeros (logic-lowvalues) and, if so, to pass a logic-high value to the zero flag 858 inorder to set it.

The output of each of the AND gates 820 ₁ and 820 ₃ is an input intoNAND gate 857. At least one purpose of NAND gate 857 is to determinewhether the result of AND'ing the most significant bits of each of thetwo quadwords of the source and destination are both zeros (logic-lowvalues) and, if so, to pass a logic-high value to the carry flag 860 inorder to set it.

Alternative embodiments of a packed LCSZC instructions that compares theMSB for each of two quadwords may include but are not limited tooperations for unsigned quadword values in both the source anddestination as well as operations for signed quadword values in both thesource and destination, or for a combination. Other alternativeembodiments of LCSZC instructions may include operations that apply toother sizes of signed or unsigned data elements.

As is explained above, a decoder 165 may recognize and decode thecontrol signal received by processor 109, and that control signal may bethe operation code for an LCSZC instruction. Thus, decoder 165 decodesthe operation code for a LCSZC instruction.

Reference to FIG. 9 illustrates various embodiments of operation codesthat may be utilized to encode the control signal (operation code) foran LCSZC instruction. FIG. 9 illustrates a format of an instruction 900according to one embodiment of the invention. The instruction format 900includes various fields; these files may include a prefix field 910, anopcode field 920, and operand specifier fields (e.g., modR/M,scale-index-base, displacement, immediate, etc.). The operand specifierfields are optional and include a modR/M field 930, an SIB field 940, adisplacement field 950, and an immediate field 960.

One skilled in the art will recognize that the format 900 set forth inFIG. 9 is illustrative, and that other organizations of data within aninstruction code may be utilized with disclosed embodiments. Forexample, the fields 910, 920, 930, 940, 950, 960 need not be organizedin the order shown, but may be re-organized into other locations withrespect to each other and need not be contiguous. Also, the fieldlengths discussed herein should not be taken to be limiting. A fielddiscussed as being a particular member of bytes may, in alternativeembodiments, be implemented as a larger or smaller field. Also, the term“byte,” while used herein to refer to an eight-bit grouping, may inother embodiments be implemented as a grouping of any other size,including 4 bits, 16 bits, and 32 bits.

As used herein, an opcode for a specific instance of an instruction,such as an LCSZC instruction, may include certain values in the fieldsof the instruction format 200, in order to indicate the desiredoperation. Such an instruction is sometimes referred to as “an actualinstruction.” The bit values for an actual instruction are sometimesreferred to collectively herein as an “instruction code.”

For each instruction code, the corresponding decoded instruction codeuniquely represents an operation to be performed by an execution unit(such as, e.g., 130 of FIG. 1 a) responsive to the instruction code. Thedecoded instruction code may include one or more micro-operations.

The contents of the opcode field 920 specify the operation. For at leastone embodiment, the opcode field 920 for the embodiments of the LCSZCinstructions discussed herein is three bytes in length. The opcode field920 may include one, two or three bytes of information. For at least oneembodiment, a three-byte escape opcode value in a two-byte escape field118 c of the opcode field 920 is combined with the contents of a thirdbyte 925 of the opcode field 920 to specify an LCSZC operation. Thisthird byte 925 is referenced to herein as an instruction-specificopcode.

FIG. 9 illustrates that, for a second embodiment 928 of an instructionformat for an LCSZC instruction, the three-byte escape opcode value inthe two-byte field 118 c of the opcode field 920 is combined with thecontents of the prefix field 910 and the contents of theinstruction-specific opcode field 925 of the opcode field 920 to specifyan LCSZC operation.

For at least one embodiment, the prefix value 0×66 is placed in theprefix field 910 and is used as part of the instruction opcode to definethe desired operation. That is, the value in the prefix 910 field isdecoded as part of the opcode, rather than being construed to merelyqualify the opcode that follows. For at least one embodiment, forexample, the prefix value 0×66 is utilized to indicate that thedestination and source operands of an LCSZC instruction reside in128-bit Intel® SSE2 XMM registers. Other prefixes can be similarly used.However, for at least some embodiments of the LCSZC instructions, aprefix may instead be used in the traditional role of enhancing theopcode or qualifying the opcode under some operational condition.

A first embodiment 926 and a second embodiment 928 of an instructionformat both include a 3-byte escape opcode field 118 c and aninstruction-specific opcode field 925. The 3-byte escape opcode field118 c is, for at least one embodiment, two bytes in length. Theinstruction format 926 uses one of four special escape opcodes, calledthree-byte escape opcodes. The three-byte escape opcodes are two bytesin length, and they indicate to decoder hardware that the instructionutilizes a third byte in the opcode field 920 to define the instruction.The 3-byte escape opcode field 118 c may lie anywhere within theinstruction opcode and need not necessarily be the highest-order orlowest-order field within the instruction.

For at least one embodiment, at least four three-byte escape opcodevalues are defined:0×0F3y, where y is 0×8, 0×9, 0×A or 0×B. Whilecertain embodiments of LCSZC instruction opcodes are disclosed herein asincluding the value “0×0F38” as the three-byte escape opcode value, suchdisclosure should not taken to be limiting. Other embodiments mayutilize other escape opcode values.

Table 3 below, sets forth examples of LCSZC instruction codes usingprefixes and three-byte escape opcodes.

TABLE 3 Instruction Definition PTEST xmm1, mxx2/m128 Compare all bits insource 128-bit register or 128- bit memory with 128-bit destination inregister; set ZF if xmm2/m128 AND xmm1 is all zeros; otherwise clear ZF.Set CF if xmm2/m128 AND NOT xmm1 result is all zeros; otherwise clearCF. TESTPS xmm1, xmm2/m128 Compare MSB for each of four packeddoublewords in source (128-bit register or 128-bit memory) withcorresponding MSB for each of four packed doublewords in destination(128-bit register); set ZF if MSB (bits 127, 95, 63 and 31) of xmm2/m128AND xmm1 is all zeros; otherwise clear ZF. Set CF if MSB (bits 127, 95,63 and 31) xmm2/m128 AND NOT xmm1 result is all zeros; otherwise clearCF. TESTPD xmm1, xmm2/m128 Compare MSB for each of two packed quadwordsin source (128-bit register or 128-bit memory) with corresponding MSBfor each of two packed quadwords in destination (128-bit register); setZF if MSB (bits 127 and 63) of xmm2/m128 AND xmm1 is all zeros;otherwise clear ZF. Set CF if MSB (bits 127 and 63) of xmm2/m128 AND NOTxmm1 result is all zeros; otherwise clear CF.

For at least one embodiment, the value in the source or destinationoperand may be utilized as a mask. The programmer's choice regardingwhether to use the source or destination operand as the mask value maybe driven, at least in part, by the desired behavior. For example, usingthe second operand (source) as the mask value, the resultant behaviormay be stated as: “If everything under the makes is “0”, set ZF; ifeverything under the mask is “1”, set CF.” On the other hand, when usingthe first argument (destination) as the mask value, the resultantbehavior may be stated as: “If everything under the mask is “0”, set ZF;if everything under the mask is “0”, set CF.”

To perform the equivalent of at least some embodiments of the packedLCSZC instructions discussed above in connection with FIGS. 7 c, 7 d, 8b and 8 c, additional instructions are needed, which adds machine cyclelatency to the operation. For example, the pseudocode set forth in Table4, below, illustrates the savings in instructions using a PTESTinstruction versus an instruction set that does not include the PTESTinstruction.

TABLE 4 PTEST instruction- No PTEST Instruction- movdqa xmm0, _x[eax]movdqa xmm0, _x[eax] pcmpeqd xmm0, pcmpeqd xmm0,const_00000001000000010000000100000001const_00000001000000010000000100000001 PTEST xmm0, xmm0 pmovmskb eax,xmm0 Jz all_under_mask_zero Test eax, eax Jz all_under_mask_zero

The pseudocode set forth in Table 4 helps to illustrate that thedescribed embodiments of the LCSZC instruction can be used to improvethe performance of software code. As a result, the LCSZC instruction canbe used in a general purpose processor to improve the performance of agreater number algorithms than the described prior art instructions.

Alternative Embodiments

While the described embodiments use comparisons of the MSB for 32-bitdata elements and 64-bit data elements for the packed embodiments of theLCSZC instructions, alternative embodiments may use different sizedinputs, different-sized data elements, and/or comparison of differentbits (e.g., the LSB of the data elements). In addition, while in somedescribed embodiments Source1 and Dest each contain 128-bits of data,alternative embodiment could operate on packed data having more or lessdata. For example, one alternative embodiment operates on packed datahaving 64-bits of data. Also, the bits compared by the LCSZC instructionneed not necessarily represent the same respective bit position for eachof the packed data elements.

While the invention has been described in terms of several embodiments,those skilled in the art will recognize that the invention is notlimited to the embodiments described. The method and apparatus of theinvention can be practiced with modification and alteration within thespirit and scope of the appended claims. The description is thus to beregarded as illustrative instead of limiting on the invention.

The above description is intended to illustrate preferred embodiments ofthe present invention. From the discussion above it should also beapparent that especially in such an area of technology, where growth isfast and further advancements are not easily foreseen, the invention maybe modified in arrangement and detail by those skilled in the artwithout departing from the principles of the present invention withinthe scope of the accompanying claims.

1. A processor, comprising: a cache to store data; instruction decodelogic to decode one or more instructions; a data register file includinga set of 128-bit packed data registers, the packed data registers tostore packed single-precision floating point (SPFP) data elementsincluding a first SPFP data element and a second SPFP data element; andan execution unit to execute a comparison instruction to compare thefirst SPFP data element and the second SPFP data element and toresponsively set at least one bit of data to indicate a result of thecomparison, the at least one bit of data to control operation of abranch instruction.
 2. The processor as in claim 1 wherein the registerfile comprises one set of physical registers for storing floating pointvalues and vector data elements.
 3. The processor as in claim 1 whereinthe data elements are each a byte in length.
 4. The processor as inclaim 1 wherein the data elements are each a word in length.